package com.example.administrator.fastdream.date.utils;

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;

import com.example.administrator.fastdream.view.activity.LoginActivity;


public class LoginHelper {

    public static void login(Activity activity, LoginCallBack loginCallBack) {
        if (TextUtils.isEmpty((String) CacheUtils.get("token"))) {
            CacheUtils.put("token", "");
            activity.startActivity(new Intent(activity, LoginActivity.class));
        } else {
            if (loginCallBack != null) {
                loginCallBack.onLogin();
            }
        }
    }

    public interface LoginCallBack {
        void onLogin();
    }

    public static void loginOut() {
        CacheUtils.removeAll();
    }
}
